//
//  FootballAssistOrderTableViewCell.m
//  LiveSoftware
//
//  Created by lanou3g on 15/7/18.
//  Copyright (c) 2015年 lanou3g. All rights reserved.
//

#import "FootballAssistOrderTableViewCell.h"

#define kFootballScoreAndAssistOrderFont 13

@implementation FootballAssistOrderTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // 间隙
        CGFloat backViewW = kScreenWidth;
        CGFloat labelW1 = kScreenIp6(40);
        CGFloat teamViewW = kScreenIp6(130);
        CGFloat player_nameW = kScreenIp6(110);
        CGFloat gap = (kScreenWidth - labelW1 - teamViewW - player_nameW - labelW1 ) / 5;
        CGFloat backViewH = kScreenIp6(50);
        CGFloat labelH = kScreenIp6(50);
        
        self.backView = [[UIView alloc] initWithFrame:CGRectMake(0 , 0, backViewW, backViewH)];
        //                self.backView.backgroundColor = [UIColor greenColor];
        [self addSubview:_backView];
        
        self.num = [[UILabel alloc] initWithFrame:CGRectMake(gap, 0, labelW1, labelH)];
        //        self.num.backgroundColor = [UIColor redColor];
        self.num.textAlignment = NSTextAlignmentCenter;
        self.num.font = [UIFont systemFontOfSize:kFootballScoreAndAssistOrderFont];
        
        [self.backView addSubview:_num];
        
        
        self.player_name = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_num.frame) + gap, 0, player_nameW, labelH)];
        self.player_name.font = [UIFont systemFontOfSize:kFootballScoreAndAssistOrderFont];
        //                self.player_name.backgroundColor = [UIColor redColor];
        self.player_name.adjustsFontSizeToFitWidth = YES;
        [self.backView addSubview:_player_name];
        
        self.teamView = [[UIView alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_player_name.frame) + gap, 0, teamViewW, labelH)];
        //                self.teamView.backgroundColor = [UIColor redColor];
        [self.backView addSubview:_teamView];
        
        CGFloat logoW = kScreenIp6(30);
        self.logo = [[UIImageView alloc] initWithFrame:CGRectMake(0,(labelH - logoW) / 2 , logoW, logoW)];
        [self.teamView addSubview:self.logo];
        
        CGFloat team_nameW = kScreenIp6(90);
        self.team_name = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.logo.frame) + kScreenIp6(5), 0, team_nameW, labelH)];
        self.team_name.font = [UIFont systemFontOfSize:kFootballScoreAndAssistOrderFont];
        //        self.team_name.backgroundColor = [UIColor blueColor];
        [self.teamView addSubview:_team_name];
        
        self.assist = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_teamView.frame) + gap, 0, labelW1, labelH)];
        self.assist.textAlignment = NSTextAlignmentCenter;
        self.assist.font = [UIFont systemFontOfSize:kFootballScoreAndAssistOrderFont];
        
        //               self.assist.backgroundColor = [UIColor redColor];
        [self.backView addSubview:_assist];
        
        //线
        CGFloat partHeight = _backView.frame.size.height - kScreenIp6(1);
        UIView *footLineView = [[UIView  alloc]initWithFrame:CGRectMake( 0, partHeight, kScreenWidth, 0.5)];
        
        footLineView.backgroundColor = [UIColor colorWithWhite:0.699 alpha:1.000];
        
        // 设置 cell 点击没有变化
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        [self addSubview:footLineView];
        
        
        
        
    }
    return self;
}



- (void)setDataWithAssistOrderModel:(FootballAssistOrderModel *)model
{
    self.num.text = model.num;
    self.player_name.text = model.player_name;
    self.team_name.text = model.team_name;
    self.assist.text = model.item1;
}

@end
